﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web.Modal
{
    public partial class MapFunctionAddModal : System.Web.UI.UserControl
    {
        #region | InitAccess |

        public void InitAccess()
        {
            // Init Access
            AccessToolbar.Resource = "Resource";
            AccessToolbar.SaveText = "Save";
            AccessToolbar.CancelText = "Cancel";
            AccessToolbar.AddVisible = false;
            AccessToolbar.EditVisible = false;
            AccessToolbar.CopyVisible = false;
            AccessToolbar.DeleteVisible = false;
            AccessToolbar.SearchVisible = false;
            //
            AccessToolbar.SaveToolTip = "Save";
            AccessToolbar.CancelToolTip = "CancelOrUndo";
            //
            AccessToolbar.SaveClick += OnSaveClick;
            AccessToolbar.CancelClick += OnCancelClick;
            AccessToolbar.CancelAttributes.Add("OnClick", "pcModal.Hide();");
        }

        private void OnCancelClick(object sender, EventArgs e)
        {

        }

        private void OnSaveClick(object sender, EventArgs e)
        {

        }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            InitAccess();
        }

        public void OnLoad(Core.AccessFlag flag)
        {
            if (flag == Core.AccessFlag.Add || flag == Core.AccessFlag.Copy)
                Page.ClientScript.RegisterStartupScript(typeof(bool), "AA7A4297-8626-43CD-90B9-D4F07D1FA9AF", "pcModal.Show();", true);
        }
    }
}